IDIR =./include

CC=gcc
CFLAGS=-I$(IDIR)

#vpath %.c ./common . #eq below
vpath %.c ./common:.

ODIR=obj
LDIR =./lib

LIBS=-lm

_DEPS = make_sample.h
#DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) #eq below
DEPS = $(_DEPS:%=$(IDIR)/%)

_OBJ = hello.o make_sample.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

$(ODIR)/%.o: %.c $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

make_sample: $(OBJ)
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ make_sample
